<%@ page language="java" contentType="text/json; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.fasterxml.jackson.databind.ObjectMapper" %>    
<%
	Thread.currentThread().sleep(3000);
	//{total:100, data:[{code:'1001',name:'张三'},{code:'1002',name:'李四'}]}
	ObjectMapper mapper = new ObjectMapper();
	Map map = new HashMap();
	map.put("total", 100);
	 
	List list = new ArrayList();
	for (int i=0; i<2; i++) {
		Map entry = new HashMap();
		entry.put("code", 1000 + i);
		entry.put("name", "张三" + i);
		list.add(entry);
	}
	map.put("data", list);
	String jsonString = mapper.writeValueAsString(map);
	out.println(jsonString);
%>